package com.acp.controller;

import com.acp.model.DcsFeedback;
import com.acp.result.ResultInfo;
import com.acp.service.DcsFeedbackService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * All rights Reserved, Designed By 姑苏区政府大数据中心
 *
 * @version V1.0
 * @Title: null.java
 * @Package com.dci.controller.construction
 * @Description: 反馈信息管理
 * @author: 张星亮
 * @date: 2019/4/5
 * @Copyright: 2019 姑苏区政府大数据中心. All rights reserved.
 * 注意：本内容仅限于姑苏区政府大数据中心内部传阅，禁止外泄以及用于其他的商业目
 */


@Controller
@RequestMapping("/feedback")
public class DcsFeedbackController {
    @Resource
    private DcsFeedbackService dcsFeedbackService;


    /**
     * 新增反馈信息
     * @param dcsFeedback
     * @return ResultInfo 封装的返回参数  保存成功msg:906 保存失败msg:911
     */
    @PostMapping("/addDcsFeedback")
    @ResponseBody
    public ResultInfo addDcsFeedback(@RequestBody DcsFeedback dcsFeedback) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = sdf.format(date);
        dcsFeedback.setDate(time);
        return dcsFeedbackService.addDcsFeedback(dcsFeedback);
    }

    /**
     * 删除反馈信息
     *
     * @param id
     * @return ResultInfo 封装的返回参数  保存成功msg:906 保存失败msg:911
     */
    @PostMapping("/deleteFeedback")
    @ResponseBody
    public int deleteFeedback(@RequestParam("feedbackId") String id) {
        return dcsFeedbackService.deleteFeedback(id);
    }

}
